<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of ConnectionFactory
 *
 * @author instrutor
 */
class ConnectionFactory {

    private $conn = null;
    private $tipo = 'mysql';
    private $host = 'localhost';
    private $db = 'RH';
    private $usuario = 'root';
    private $senha = '';

    function __construct() {
        if (is_null($this->conn)) {
            $this->conn = new PDO($this->tipo . ':host=' . $this->host . ';dbname=' . $this->db,
                            $this->usuario, $this->senha,
                            array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET Names UTF8'));
        }

    }

    
    public function getConnection(){
        return $this->conn;
    }
    
    
    public function __destruct() {
        unset ($this->conn);
    }

    
    
    
}

?>
